package pack1014;

// 构造器
public class DemoF {
    int a;
    String b;
    char c;
    double d;

    // 初始化对象：给对象的属性赋值
    public DemoF() {
        // 构造器的主体
        System.out.println("DemoF无参数构造器被执行了");
        a = 1;
        b = "abc";
        c = 'y';
        d = 78.9;
    }

    public DemoF(int a1) {
        a = a1;
    }

    public DemoF(String b1) {
        b = b1;
    }

    public DemoF(int a1, String b1) {
        a = a1;
        b = b1;
    }

    public DemoF(String b1, int a1) {
        b = b1;
        a = a1;
    }

    @Override
    public String toString() {
        return "DemoF{" +
                "a=" + a +
                ", b='" + b + '\'' +
                ", c=" + c +
                ", d=" + d +
                '}';
    }
}